<template>
	<page-meta :page-style="'overflow:'+(isFansPop||popupGImg?'hidden':'visible')"></page-meta>
	<view class="groupzhactiveform">
		<view class="fansmeeting_form_box" style="margin-top: 0;">
			<view class="fansmeeting_form_topbk_box">
				<image class="fansmeeting_form_topbk" :src="onlinePic+'fansmeeting/zh/form_bg_zh.png'" mode="widthFix">
				</image>
			</view>
			<view style="margin-top: 30%;">
				<view style="padding-bottom:30rpx;">
					<view class="groupmanage_input_box">
						<view class="display_flex">
							<view class="mr-5" style="min-width: 100rpx;">姓名</view>
							<input class="flex-1" v-model="zhinfo.name" maxlength="8" placeholder="您的姓名" />
						</view>
					</view>
					<view class="groupmanage_input_box">
						<view class="display_flex">
							<view class="mr-5" style="min-width: 100rpx;">手机号</view>
							<input class="flex-1" v-model="zhinfo.mobile" maxlength="18" placeholder="您的手机号" />
						</view>
					</view>
					<view class="groupmanage_input_box">
						<view class="display_flex">
							<view class="mr-5" style="min-width: 100rpx;">您是否有车</view>
							<view class="display_flex flex-1">
								<view class="display_flex" @click="changeHasCar(1)">
									<uni-icons v-if="zhinfo.is_have_car==1" type="circle-filled" size="20"
										color="#191919"></uni-icons>
									<uni-icons v-else type="circle" color="#191919" size="20"></uni-icons>
									<span>是</span>
								</view>
								<view class="display_flex ml-25" @click="changeHasCar(0)">
									<uni-icons v-if="zhinfo.is_have_car==0" type="circle-filled" size="20"
										color="#191919"></uni-icons>
									<uni-icons v-else type="circle" color="#191919" size="20"></uni-icons>
									<span>否</span>
								</view>
							</view>
						</view>
					</view>
					<view v-if="zhinfo.is_have_car==1">
						<view class="car_num_type_box">
							<view v-for="item in tabslist" :key="item.id"
								:class="zhinfo.car_number_type==item.id?'num_type_cell num_type_cell_on':'num_type_cell'"
								@click="changeCarNumType(item.id)">
								{{item.name}}
							</view>
						</view>
						<view class="groupmanage_input_box">
							<view class="display_flex">
								<view class="mr-5" style="min-width: 100rpx;">车牌号</view>
								<input class="flex-1" v-model="zhinfo.car_number" maxlength="8" placeholder="您的车牌号" />
							</view>
						</view>
						<view class="groupmanage_input_box">
							<view class="mr-5">行驶证</view>
							<image v-if="zhinfo.driving_license_pic" class="cars_img" style="height: 325rpx;"
								:src="picUrl+zhinfo.driving_license_pic" mode="aspectFill"
								@click="uploadFansDrivingImg(index)">
							</image>
							<view v-else class="cars_bkimg_box" @click="uploadFansDrivingImg(index)">
								<image class="cars_bkimg" :src="onlinePic+'cars_bk.png'" mode="widthFix">
								</image>
								<view class="cars_bkimg_text_box">
									<image class="cars_camera_img" :src="onlinePic+'cars_camera.png'">
									</image>
									<view class="mt-5 f-11 text-c">请上传行驶证照片</view>
									<view class="mt-5 f-11 text-c" style="color: #C92359;">
										请上传清晰的行驶证照片,否则无法通过活动审核!
									</view>
								</view>
							</view>
						</view>
						<view class="groupmanage_input_box">
							<view class="mr-5">您的车辆信息</view>
							<view class="groupmanage_input_box">
								<view class="display_flex">
									<view class="mr-5" style="min-width: 100rpx;">您是否为斯巴鲁车主</view>
									<view class="display_flex flex-1">
										<view class="display_flex" @click="changeSubaruMan(1)">
											<uni-icons v-if="zhinfo.is_subaru==1" type="circle-filled" size="20"
												color="#191919"></uni-icons>
											<uni-icons v-else type="circle" color="#191919" size="20"></uni-icons>
											<span>是</span>
										</view>
										<view class="display_flex ml-25" @click="changeSubaruMan(0)">
											<uni-icons v-if="zhinfo.is_subaru==0" type="circle-filled" size="20"
												color="#191919"></uni-icons>
											<uni-icons v-else type="circle" color="#191919" size="20"></uni-icons>
											<span>否</span>
										</view>
									</view>
								</view>
							</view>
							<view class="groupmanage_input_box" v-if="zhinfo.is_subaru==1">
								<view class="display_flex">
									<view class="mr-5" style="min-width: 100rpx;">爱车车型</view>
									<uni-data-select class="flex-1" v-model="zhinfo.car_series" :localdata="seriesList"
										:clear="false" placeholder="您的爱车车型"></uni-data-select>
								</view>
							</view>
							<view class="f-11 ml-15 mt-5 c-999999">{{auditinfo.car_model_tips}}</view>
							<view class="groupmanage_input_box" v-if="zhinfo.car_series=='其他'">
								<view class="display_flex">
									<view class="mr-5" style="min-width: 100rpx;">爱车车型</view>
									<input class="flex-1" v-model="zhinfo.car_series_other" maxlength="12"
										placeholder="您的爱车车型" />
								</view>
							</view>
							<view class="groupmanage_input_box" v-if="zhinfo.is_subaru==0">
								<view class="display_flex">
									<view class="mr-5" style="min-width: 100rpx;">爱车品牌</view>
									<input class="flex-1" v-model="zhinfo.car_brand" placeholder="您的爱车品牌" />
								</view>
							</view>
						</view>
						<view class="groupmanage_input_box">
							<view class="mr-5">爱车照片</view>
							<image v-if="zhinfo.pic" class="cars_img" style="height: 325rpx;" :src="picUrl+zhinfo.pic"
								mode="aspectFill" @click="uploadZHCarImg(index)">
							</image>
							<view v-else class="cars_bkimg_box" @click="uploadZHCarImg(index)">
								<image class="cars_bkimg" :src="onlinePic+'cars_bk.png'" mode="widthFix">
								</image>
								<view class="cars_bkimg_text_box">
									<image class="cars_camera_img" :src="onlinePic+'cars_camera.png'">
									</image>
									<view class="mt-5 f-11 text-c">请上传一张您的爱车照片</view>
									<view class="mt-5 f-11 text-c" style="color: #C92359;">
										请上传车牌清晰可见的照片,否则无法通过活动审核!
									</view>
								</view>
							</view>
						</view>
						<view v-if="zhinfo.is_subaru==1" class="groupmanage_input_box">
							<view class="mr-5">选择活动环节(多选)</view>
							<view class="mt-10">
								<uni-row :gutter="20">
									<uni-col v-for="(item,index) in zhinfo.festival_project_popup_arr" :key="item.id"
										:span="12">
										<view :class="item.isSelect==1?'project_type_cell_on':'project_type_cell'"
											@click="changeMoreProjects(item.id,index,item.isChange)">
											<view class="text-c">
												<view>{{item.name}}</view>
												<view>￥{{item.price}}</view>
												<view v-if="item.tips" class="c-red f-11">{{item.tips}}
												</view>
											</view>
											<image v-if="item.is_paid==1" class="projects_pay_icon"
												:src="picUrl+zhinfo.projects_pay_icon">
											</image>
											<image v-if="item.is_paid==0" class="projects_pay_icon"
												:src="onlinePic+'fansmeeting/projects_free_icon.png'">
											</image>
											<image v-if="item.isSelect==1" class="projects_on_icon"
												:src="onlinePic+'fansmeeting/projects_on.png'"></image>
										</view>
										<view v-if="item.id==3" class="project_type_content"
											style="min-height: 50px;display: flex;justify-content: center;">
											<view class="f-13 c-black mr-5" style="margin-top: 5rpx;">人数:
											</view>
											<uni-section type="line" padding>
												<uni-number-box :min="1" :max="4" v-model="zhinfo.project_man_num"
													:disabled="item.isSelect!=1" @change="changeProjectManNum" />
											</uni-section>
										</view>
										<view v-else class="project_type_content" style="min-height: 50px;">
											{{item.content}}
										</view>
									</uni-col>
								</uni-row>
							</view>
						</view>
						<view v-if="zhinfo.is_subaru==1&&zhinfo.project_man_card.length>0"
							class="groupmanage_input_box">
							<view class="mr-5">巡游随行<span class="c-red f-w">乘客</span>购买保险所需信息(与证件信息一致)</view>
							<view v-for="(item,index) in zhinfo.project_man_card" :key="index"
								class="groupmanage_input_box_new">
								<view class="display_flex" style="padding: 10rpx;">
									<view class="mr-5" style="min-width: 100rpx;">姓名</view>
									<input class="flex-1" v-model="zhinfo.project_man_card[index].name" maxlength="8"
										placeholder="输入姓名" />
								</view>
								<view class="display_flex mt-10" style="padding: 10rpx;">
									<view class="mr-5" style="min-width: 100rpx;">证件号码</view>
									<input class="flex-1" v-model="zhinfo.project_man_card[index].id_card"
										maxlength="18" placeholder="输入证件号码" />
								</view>
							</view>
						</view>
						<view v-if="listWithCountsM.length>1" class="groupmanage_input_box">
							<view class="mr-5"><span class="c-red f-w">驾驶员</span>购买保险所需信息(与证件信息一致)</view>
							<view class="groupmanage_input_box_new">
								<view class="display_flex" style="padding: 10rpx;">
									<view class="mr-5" style="min-width: 100rpx;">您的姓名</view>
									<input class="flex-1" v-model="zhinfo.name" maxlength="8" placeholder="您的姓名" />
								</view>
								<view class="display_flex mt-10" style="padding: 10rpx;">
									<view class="mr-5" style="min-width: 100rpx;">证件号码</view>
									<input class="flex-1" v-model="zhinfo.id_card" maxlength="18"
										placeholder="您的证件号码" />
								</view>
							</view>
						</view>
					</view>
					<view class="groupmanage_man_num_input_box">
						<view class="display_flex" style="justify-content: space-between;">
							<view class="mr-5" style="min-width: 100rpx;">随行人数</view>
							<uni-section type="line" padding>
								<uni-number-box :min="0" :max="6" v-model="zhinfo.man_num" />
							</uni-section>
						</view>
					</view>
				</view>
				<view class="fansmeeting_form_bottom_box" :style="'padding-bottom:'+ bottomSafeArea +'px;'">
					<view class="f-3 f-w ml-15 mr-15 mb-15" v-if="listWithCounts.length>0||listWithCountsM.length>0">
						活动环节预选</view>
					<view class="bottom_ticket_cell" v-if="listWithCounts.length>0||listWithCountsM.length>0">
						<view v-for="item in listWithCounts" :key="item.name" class="display_flex f-12 mt-5">
							<view class="flex-1">{{item.name}}</view>
							<view>x{{item.num}}</view>
						</view>
						<view v-for="item in listWithCountsM" :key="item.name" class="display_flex f-12 mt-5">
							<view class="flex-1">{{item.name}}</view>
							<view>x{{item.num}}</view>
						</view>
					</view>
					<view class="ticket_price_text" v-if="listWithCounts.length>0||listWithCountsM.length>0">
						购票总计：{{ticket_price}}元</view>
					<view class="fansmeeting_form_submit_btn mt-15" @click="submitZHActiveForm()">提交信息</view>
				</view>
			</view>
		</view>
		<view v-if="isFansPop" class="guide_mask_box" @click="closePopup"></view>
		<view class="fansmeeting_pop_box" v-if="isFansPop">
			<image class="pop_top_img" :src="picUrl+popImg" mode="widthFix"></image>
			<view class="fansmeeting_pop_content_box">
				<view class="f-15 text-c" v-if="popTitle">{{popTitle}}</view>
				<view class="fansmeeting_pop_content">
					<rich-text :nodes="popContent"></rich-text>
				</view>
				<view class="pd-20">
					<view v-if="popType==2&&showSubmitBtn==1" class="fansmeeting_pop_btn" @click="closeProjectsPopup">
						{{popBtn}}
					</view>
					<view v-if="popType==5&&showSubmitBtn==1" class="fansmeeting_pop_btn" @click="closeSubmitZHPopup">
						{{popBtn}}
					</view>
					<view v-if="showSubmitBtn==2" class="fansmeeting_pop_btn_def">{{popBtn}}({{popTime}}s)</view>
				</view>
			</view>
			<view v-if="popType==5" class="pop_close_icon_box">
				<uni-icons class="pop_close_icon" @click="closePopup" type="close" color="#ffffff"
					size="50"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getZHActiveInfo,
		submitZHActiveForm,
		getClubCarSeriesAll,
		noticeTemplate
	} from '@/api/motortime.js';
	let app = getApp()
	export default {
		data() {
			return {
				huodong_id: '',
				channel: '',
				tabslist: [{
					id: 1,
					name: '大陆车牌'
				}, {
					id: 2,
					name: '香港车牌'
				}, {
					id: 3,
					name: '澳门车牌'
				}],
				zhinfo: '',
				isFansPop: false,
				formIndex: 0,
				popType: 0,
				popImg: '',
				popTitle: '',
				popContent: '',
				popBtn: '',
				popTime: '',
				popTitle1: '',
				popContent1: '',
				popBtn1: '',
				popTime1: '',
				lastContent: 1,
				showSubmitBtn: 2,
				endShowSubmitBtn: 2,
				channel: '',
				seriesList: [],
				listWithCounts: [],
				listWithCountsM: [],
				ticket_price: 0,
				isSubmit: true,
				oldproject_type: '',
				oldproject_type_arr: [],
				manCardList: [],
				picUrl: app.globalData.picUrl,
				onlinePic: app.globalData.onlinePic,
				pdbottom: uni.getSystemInfoSync().safeAreaInsets.bottom ? uni.getSystemInfoSync().safeAreaInsets.bottom +
					60 : 60,
				safeBottom: uni.getSystemInfoSync().safeAreaInsets.bottom > 0 ? true : false,
				pageSafeArea: uni.getSystemInfoSync().safeAreaInsets.bottom ? uni.getSystemInfoSync().safeAreaInsets
					.bottom + 140 : 150,
				bottomSafeArea: uni.getSystemInfoSync().safeAreaInsets.bottom ? uni.getSystemInfoSync().safeAreaInsets
					.bottom : 15
			};
		},
		onShow() {
			if (!uni.getStorageSync('access_token')) {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			}
			if (uni.getStorageSync('onload')) {
				uni.showLoading({})
				this.getClubCarSeriesAll()
				this.getZHActiveInfo()
				uni.removeStorage({
					key: 'onload'
				})
			}
		},
		onLoad(options) {
			uni.showLoading({})
			this.huodong_id = options.huodong_id ? options.huodong_id : ''
			this.channel = options.channel ? options.channel : ''
			if (uni.getStorageSync('access_token')) {
				this.getClubCarSeriesAll()
				if (options.click_btn == 1) {
					this.getZHActiveInfo()
				} else {
					uni.reLaunch({
						url: '/pages/group/groupactiveinfo?huodong_id=' + this.huodong_id + '&channel=' + this
							.channel
					})
				}
			}
		},
		methods: {
			closePopup() {
				this.popupGImg = false
				if (this.popType == 5) {
					this.popTime = 5
					this.isFansPop = false
					this.showSubmitBtn = 2
					this.popTitle = ''
					this.popContent = ''
					this.popBtn = ''
					this.popTime = ''
				}
				var params = {
					event_code: '车友会修改表单',
					path: 'pages/group/groupzhactiveform',
					event_id: this.huodong_id,
					title: '',
					source_page: '车友会修改表单-关闭弹窗',
					value: '',
				}
				app.BurialPoint(params)
			},
			closeProjectsPopup() {
				this.popTime = 5
				if (this.endShowSubmitBtn == 2) {
					if (this.lastContent == 1) {
						this.isFansPop = false
						this.showSubmitBtn = 2
						this.popTitle = ''
						this.popContent = ''
						this.popContent1 = ''
						this.popBtn = ''
						this.popTime = ''
					} else {
						this.endShowSubmitBtn = 1
						this.showSubmitBtn = 2
						this.popTitle = this.popTitle1
						this.popContent = this.popContent1
						this.popBtn = this.popBtn1
						this.popTime = this.popTime1
						var that = this
						if (this.popTime > 0) {
							var Interval = setInterval(function() {
								if (that.popTime > 1) {
									that.popTime = that.popTime - 1
								} else {
									that.showSubmitBtn = 1
									that.lastContent = 1
									clearInterval(Interval)
								}
							}, 1000)
						} else {
							that.showSubmitBtn = 1
							that.lastContent = 1
						}
					}
				} else {
					this.isFansPop = false
					this.showSubmitBtn = 2
					this.popTitle = ''
					this.popContent = ''
					this.popContent1 = ''
					this.popBtn = ''
					this.popTime = ''
				}

				var params = {
					event_code: '车友会修改表单',
					path: 'pages/group/groupzhactiveform',
					event_id: this.huodong_id,
					title: '',
					source_page: '车友会修改表单-已知晓活动环节',
					value: '',
				}
				app.BurialPoint(params)
			},
			getClubCarSeriesAll() {
				getClubCarSeriesAll().then(res => {
					if (res.state == 1) {
						this.seriesList = res.data.info
					} else {
						uni.showToast({
							title: res.error[0],
							mask: true,
							icon: 'none',
							duration: 1500
						})
					}
				})
			},
			// 202412-js
			uploadZHCarImg(index) {
				var that = this
				uni.chooseMedia({
					count: 1,
					mediaType: ['image'],
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						var tempFilePaths = res.tempFiles
						uni.uploadFile({
							url: app.globalData.uploadUrl,
							filePath: tempFilePaths[0].tempFilePath,
							name: 'img',
							success: (uploadFileRes) => {
								var picdata = JSON.parse(uploadFileRes.data);
								that.zhinfo.pic = picdata.data.img
							}
						});
					}
				});
				var params = {
					event_code: '车友会修改表单',
					path: 'pages/group/groupzhactiveform',
					event_id: that.huodong_id,
					title: '',
					source_page: '车友会修改表单-上传爱车靓照',
					value: '',
				}
				app.BurialPoint(params)
			},
			uploadFansDrivingImg(index) {
				var that = this
				uni.chooseMedia({
					count: 1,
					mediaType: ['image'],
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						var tempFilePaths = res.tempFiles
						uni.uploadFile({
							url: app.globalData.uploadUrl,
							filePath: tempFilePaths[0].tempFilePath,
							name: 'img',
							success: (uploadFileRes) => {
								var picdata = JSON.parse(uploadFileRes.data);
								that.zhinfo.driving_license_pic = picdata.data.img
							}
						});
					}
				});
				var params = {
					event_code: '车友会修改表单',
					path: 'pages/group/groupzhactiveform',
					event_id: that.huodong_id,
					title: '',
					source_page: '车友会修改表单-上传爱车靓照',
					value: '',
				}
				app.BurialPoint(params)
			},
			bindchooseavatar(e) {
				var that = this
				uni.uploadFile({
					url: app.globalData.uploadUrl,
					filePath: e.detail.avatarUrl,
					name: 'img',
					success: (uploadFileRes) => {
						var picdata = JSON.parse(uploadFileRes.data);
						that.zhinfo.avatar = picdata.data.img
					}
				});
			},
			changeHasCar(type) {
				this.zhinfo.is_have_car = type
				if (type == 0) {
					this.zhinfo.project_type = 0
					this.ticket_price = 0
					this.listWithCounts = []
					this.zhinfo.festival_project_popup_arr.forEach(item => {
						if (item.id != 1) {
							item.isSelect = 0;
						}
					});
					var newlistWithCounts = []
					for (var i = 0; i < this.zhinfo.festival_project_popup_arr.length; i++) {
						if (this.zhinfo.festival_project_popup_arr[i].isSelect == 1) {
							var obj = {
								id: this.zhinfo.festival_project_popup_arr[i].id,
								name: this.zhinfo.festival_project_popup_arr[i].name,
								price: this.zhinfo.festival_project_popup_arr[i].price,
								num: 1
							}
							newlistWithCounts.push(obj)
						}
					}
					this.listWithCountsM = newlistWithCounts
				}
				var params = {
					event_code: '车友会活动详情',
					path: 'pages/group/groupactiveinfo',
					event_id: this.huodong_id,
					title: '',
					source_page: '车友会活动详情-是否有车',
					value: '',
				}
				app.BurialPoint(params)
			},
			changeSubaruMan(type) {
				this.zhinfo.is_subaru = type
				if (type == 0) {
					this.zhinfo.project_type = 0
					this.ticket_price = 0
					this.listWithCounts = []
					this.zhinfo.festival_project_popup_arr.forEach(item => {
						if (item.id != 1) {
							item.isSelect = 0;
						}
					});
					var newlistWithCounts = []
					for (var i = 0; i < this.zhinfo.festival_project_popup_arr.length; i++) {
						if (this.zhinfo.festival_project_popup_arr[i].isSelect == 1) {
							var obj = {
								id: this.zhinfo.festival_project_popup_arr[i].id,
								name: this.zhinfo.festival_project_popup_arr[i].name,
								price: this.zhinfo.festival_project_popup_arr[i].price,
								num: this.zhinfo.festival_project_popup_arr[i].id == 3 ? this.zhinfo.project_man_num :
									1
							}
							newlistWithCounts.push(obj)
						}
					}
					this.listWithCountsM = newlistWithCounts
				}
				var params = {
					event_code: '车友会活动详情',
					path: 'pages/group/groupactiveinfo',
					event_id: this.huodong_id,
					title: '',
					source_page: '车友会活动详情-是否是斯巴鲁车主',
					value: '',
				}
				app.BurialPoint(params)
			},
			changeCarNumType(id) {
				this.zhinfo.car_number_type = id
			},
			getZHActiveInfo() {
				getZHActiveInfo({
					huodong_id: this.huodong_id,
					channel: this.channel ? this.channel : '',
					huodong_club_id: this.huodong_club_id ? this.huodong_club_id : ''
				}).then(res => {
					if (res.state == 1) {
						uni.hideLoading()
						this.zhinfo = res.data.info
						this.oldproject_type_arr = res.data.info.project_type_arr
						this.oldproject_type = res.data.info.project_type
						var project_type_arr = res.data.info.project_type_arr
						var festival_project_popup_arr = res.data.info.festival_project_popup_arr

						if (!project_type_arr.includes(2)) {
							festival_project_popup_arr.forEach(item => {
								if (item.id == 3) { //判断巡游加人
									item.isChange = 2
								}
							});
						}
						var newlistWithCounts = []
						project_type_arr.forEach(value => {
							festival_project_popup_arr.forEach(item => {
								if (item.id === value) {
									item.isSelect = 1; // 如果相等，设置isSelect为1
									if (item.id == 3) {
										this.ticket_price = parseFloat(this.ticket_price) +
											parseFloat(
												item.price * res.data.info.project_man_num)
									} else {
										this.ticket_price = parseFloat(this.ticket_price) +
											parseFloat(
												item.price)
									}
									var obj = {
										id: item.id,
										name: item.name,
										price: item.price,
										num: item.id == 3 ? this.zhinfo.project_man_num : 1
									}
									newlistWithCounts.push(obj)
								}
							});
						});
						this.listWithCountsM = newlistWithCounts

						var festival_project_popup_single_arr = res.data.info.festival_project_popup_single_arr
						festival_project_popup_single_arr.forEach(item => {
							if (res.data.info.project_type === item.id) {
								this.ticket_price = parseFloat(this.ticket_price) + parseFloat(
									item.price)
								this.listWithCounts = [{
									id: item.id,
									name: item.name,
									num: 1
								}]
							}
						});
						this.zhinfo.festival_project_popup_arr = festival_project_popup_arr
						this.popImg = res.data.info.festival_popup_img
						this.huodong_join_id = res.data.info.huodong_join_id ? res.data.info.huodong_join_id : 0
						if (res.data.info.huodong_join_id > 0) {
							this.showGroupactiveinfo = true
						} else {
							uni.reLaunch({
								url: '/pages/group/groupactiveinfo?huodong_id=' + this.huodong_id +
									'&channel=' + this.channel
							})
						}
					} else {
						uni.hideLoading()
						uni.showToast({
							title: res.error[0],
							mask: true,
							icon: 'none',
							duration: 1500
						})
					}
				})
			},
			changeMoreProjects(id, index, type) {
				if (type == 1) {
					var festival_project_popup_arr = this.zhinfo.festival_project_popup_arr
					if (this.zhinfo.festival_project_popup_arr[index].isSelect == 0) {
						this.zhinfo.festival_project_popup_arr[index].isSelect = 1
						this.isFansPop = true
						this.ticket_price = parseFloat(this.ticket_price) + parseFloat(this.zhinfo
							.festival_project_popup_arr[
								index].price)
						if (this.zhinfo.festival_project_popup_arr[index].id == 2) {
							this.zhinfo.festival_project_popup_arr.forEach(item => {
								if (item.id == 3) { //判断巡游加人
									item.isChange = 1
								}
							});
						}
						if (this.zhinfo.festival_project_popup_arr[index].id == 3) {
							this.zhinfo.project_man_num = 1
							this.zhinfo.project_man_card = [{
								name: '',
								id_card: ''
							}]
						}
					} else {
						this.zhinfo.festival_project_popup_arr[index].isSelect = 0
						// this.ticket_price = parseFloat(this.ticket_price) - parseFloat(this.zhinfo
						// 	.festival_project_popup_arr[
						// 		index].price)
						if (this.zhinfo.festival_project_popup_arr[index].id == 2) {
							this.ticket_price = parseFloat(this.ticket_price) - parseFloat(this.zhinfo
								.festival_project_popup_arr[
									index].price)
							this.zhinfo.festival_project_popup_arr.forEach(item => {
								if (item.id == 3) { //判断巡游加人
									this.ticket_price = parseFloat(this.ticket_price) - parseFloat(this.zhinfo
										.project_man_num * item.price)
									item.isChange = 2
									item.isSelect = 0
									this.zhinfo.project_man_num = 0
									this.zhinfo.project_man_card = []
								}
							});
						}
						if (this.zhinfo.festival_project_popup_arr[index].id == 3) {
							this.ticket_price = parseFloat(this.ticket_price) - parseFloat(this.zhinfo
								.project_man_num * this.zhinfo.festival_project_popup_arr[index].price)
							this.zhinfo.project_man_num = 0
							this.zhinfo.project_man_card = []
						}
						if(this.zhinfo.festival_project_popup_arr[index].id == 4){
							this.ticket_price = parseFloat(this.ticket_price) - parseFloat(this.zhinfo
								.festival_project_popup_arr[
									index].price)
						}
					}
					// this.zhinfo.festival_project_popup_arr[index].isSelect = this.zhinfo.festival_project_popup_arr[index]
					// 	.isSelect == 1 ? 0 : 1
					this.popTitle = festival_project_popup_arr[index].popup_title
					this.popTitle1 = festival_project_popup_arr[index].popup_protocol_title
					this.popContent = festival_project_popup_arr[index].popup_content
					this.popContent1 = festival_project_popup_arr[index].popup_protocol
					this.popBtn = festival_project_popup_arr[index].festival_popup_button_name
					this.popBtn1 = festival_project_popup_arr[index].popup_protocol_button_name
					this.popTime = festival_project_popup_arr[index].popup_time
					this.popTime1 = festival_project_popup_arr[index].popup_protocol_time
					if (festival_project_popup_arr[index].popup_protocol) {
						this.lastContent = 2
					} else {
						this.lastContent = 1
					}

					this.popType = 2
					var newlistWithCounts = []
					this.zhinfo.festival_project_popup_arr.forEach(item => {
						if (item.isSelect == 1) {
							var obj = {
								id: item.id,
								name: item.name,
								price: item.price,
								num: item.id == 3 ? this.zhinfo.project_man_num : 1 //判断巡游加人
							}
							newlistWithCounts.push(obj)
						}
					});
					this.listWithCountsM = newlistWithCounts
					if (this.popTime > 0) {
						var that = this
						var Interval = setInterval(function() {
							if (that.popTime > 1) {
								that.popTime = that.popTime - 1
							} else {
								that.showSubmitBtn = 1
								clearInterval(Interval)
							}
						}, 1000)
					} else {
						this.showSubmitBtn = 1
					}
					var params = {
						event_code: '车友会修改表单',
						path: 'pages/group/groupzhactiveform',
						event_id: this.huodong_id,
						title: '',
						source_page: '车友会修改表单-切换活动环节(多选)',
						value: id,
					}
					app.BurialPoint(params)
				} else if (type == 2) {
					uni.showToast({
						title: "请先选择赛道巡游",
						mask: true,
						icon: 'none',
						duration: 1500
					})
				}
			},
			changeProjectManNum(e) {
				this.listWithCountsM.forEach(item => {
					if (item.id == 3) { //判断巡游加人
						if (item.num < e) {
							var poor = parseFloat(e - item.num)
							this.ticket_price = parseFloat(this.ticket_price) + parseFloat(poor * item.price)
							item.num = e
							var obj = {
								name: '',
								id_card: ''
							}
							this.zhinfo.project_man_card.push(obj)

						} else if (item.num > e) {
							var poor = parseFloat(item.num - e)
							this.ticket_price = parseFloat(this.ticket_price) - parseFloat(poor * item.price)
							item.num = e
							this.zhinfo.project_man_card.pop()
						}
					}
				});
			},

			submitZHActiveForm() {
				var that = this
				var list = that.zhinfo.festival_project_popup_arr
				console.log(list)
				var project_type_arr = []
				for (var i = 0; i < list.length; i++) {
					if (list[i].isSelect == 1) {
						project_type_arr.push(list[i].id)
					}
				}
				console.log(project_type_arr)
				that.zhinfo.project_type_arr = project_type_arr
				console.log(that.zhinfo.project_type_arr)
				if (uni.getStorageSync('access_token')) {
					if (that.isSubmit) {
						that.isSubmit = false
						if (that.zhinfo.name == '' || !that.zhinfo.name) {
							uni.showToast({
								title: '请输入姓名',
								mask: true,
								icon: 'none',
								duration: 1500
							})
							that.isSubmit = true
							return false;
						}
						if (that.zhinfo.mobile == '' || !that.zhinfo.mobile) {
							uni.showToast({
								title: '请输入手机号',
								mask: true,
								icon: 'none',
								duration: 1500
							})
							that.isSubmit = true
							return false;
						}
						if (that.zhinfo.is_have_car == 1) {
							if (that.zhinfo.car_number == '' || !that.zhinfo.car_number) {
								uni.showToast({
									title: '请输入车牌号',
									mask: true,
									icon: 'none',
									duration: 1500
								})
								that.isSubmit = true
								return false;
							} else if (that.zhinfo.car_number < 6) {
								uni.showToast({
									title: '请输入正确的车牌号',
									mask: true,
									icon: 'none',
									duration: 1500
								})
								that.isSubmit = true
								return false;
							}
							if (that.zhinfo.driving_license_pic == '') {
								uni.showToast({
									title: '请上传行驶证照片',
									mask: true,
									icon: 'none',
									duration: 1500
								})
								that.isSubmit = true
								return false;
							}

							if (that.zhinfo.is_subaru == 1) {
								if (that.zhinfo.car_series == '' || !that.zhinfo.car_series) {
									uni.showToast({
										title: '请选择爱车车型',
										mask: true,
										icon: 'none',
										duration: 1500
									})
									that.isSubmit = true
									return false;
								}
								if (that.zhinfo.car_series == '其他') {
									if (that.zhinfo.car_series_other == '' || !that.zhinfo.car_series_other) {
										uni.showToast({
											title: '请输入爱车车型',
											mask: true,
											icon: 'none',
											duration: 1500
										})
										that.isSubmit = true
										return false;
									}
								}
							} else {
								if (that.zhinfo.car_brand == '' || !that.zhinfo.car_brand) {
									uni.showToast({
										title: '请输入爱车品牌',
										mask: true,
										icon: 'none',
										duration: 1500
									})
									that.isSubmit = true
									return false;
								}
							}
							if (that.zhinfo.pic == '') {
								uni.showToast({
									title: '请上传爱车照片',
									mask: true,
									icon: 'none',
									duration: 1500
								})
								that.isSubmit = true
								return false;
							}
						}
						if (that.zhinfo.project_type_arr.length == 0) {
							uni.showToast({
								title: '请选择活动环节',
								mask: true,
								icon: 'none',
								duration: 1500
							})
							that.isSubmit = true
							return false;
						}
						if (that.zhinfo.project_type_arr.includes(3)) {
							for (let i = 0; i < that.zhinfo.project_man_card.length; i++) {
								const item = that.zhinfo.project_man_card[i];
								if (!item.name || item.name.trim() === '') {
									uni.showToast({
										title: '请输入姓名',
										mask: true,
										icon: 'none',
										duration: 1500
									})
									that.isSubmit = true
									return false;
								}
								if (!item.id_card || item.id_card.trim() === '') {
									uni.showToast({
										title: '请输入证件号码',
										mask: true,
										icon: 'none',
										duration: 1500
									})
									that.isSubmit = true
									return false;
								}
							}
						}
						if (that.listWithCountsM.length > 1) {
							if (that.zhinfo.id_card == '' || !that.zhinfo.id_card) {
								uni.showToast({
									title: '请输入证件号码',
									mask: true,
									icon: 'none',
									duration: 1500
								})
								that.isSubmit = true
								return false;
							}
						}

						uni.requestSubscribeMessage({
							tmplIds: ['rcQkW8wcn38CXiWvvjjQgFx3SscCmBguRKsd3N6Ip1U'],
							success: function(res) {
								noticeTemplate({
									template_type: 5 //4:车友会；5:活动报名结果；6:活动创建结果
								}).then(res => {
									if (res.state == 1) {

									} else {
										that.isSubmit = true
										var params = {
											event_code: '车友会修改表单',
											path: 'pages/group/groupzhactiveform',
											event_id: that.huodong_id,
											title: '',
											source_page: '车友会修改表单-拒绝消息通知',
											value: '',
										}
										app.BurialPoint(params)
									}
								})
							},
							fail: function(e) {
								console.log(e)
							}
						})
						that.popType = 5
						that.isFansPop = true
						that.popTitle = that.zhinfo.festival_popup_update_title
						that.popContent = that.zhinfo.festival_popup_update_content
						that.popBtn = that.zhinfo.festival_popup_submit_name
						that.popTime = that.zhinfo.festival_popup_update_time
						if (that.popTime > 0) {
							var Interval = setInterval(function() {
								if (that.popTime > 1) {
									that.popTime = that.popTime - 1
								} else {
									that.showSubmitBtn = 1
									clearInterval(Interval)
								}
							}, 1000)
						} else {
							that.showSubmitBtn = 1
						}
					}
				} else {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}
			},
			closeSubmitZHPopup() {
				var that = this
				var form = {
					channel: that.channel,
					club_id: that.club_id,
					huodong_id: that.huodong_id,
					huodong_join_id: that.huodong_join_id,
					name: that.zhinfo.name,
					mobile: that.zhinfo.mobile,
					is_have_car: that.zhinfo.is_have_car,
					car_number_type: that.zhinfo.car_number_type,
					car_number: that.zhinfo.car_number,
					driving_license_pic: that.zhinfo.driving_license_pic,
					car_series: that.zhinfo.car_series ? that.zhinfo.car_series : '',
					car_series_other: that.zhinfo.car_series_other ? that.zhinfo
						.car_series_other : '',
					car_brand: that.zhinfo.car_brand ? that.zhinfo.car_brand : '',
					is_subaru: that.zhinfo.is_subaru,
					pic: that.zhinfo.pic,
					man_num: that.zhinfo.man_num,
					id_card: that.zhinfo.id_card,
					invitation_id: uni.getStorageSync('InvitationId') ? uni.getStorageSync(
						'InvitationId') : '',
					project_man_num: that.zhinfo.project_man_num,
					project_man_card: that.zhinfo.project_man_card,
					project_type: that.zhinfo.project_type,
					project_type_arr: that.zhinfo.project_type_arr
				}
				console.log('修改信息');
				console.log(form)
				that.closeSubmitZHPopupOk(form, 2)
			},
			closeSubmitZHPopupOk(form, pro_type) {
				var that = this
				that.isFansPop = false
				that.showSubmitBtn = 2
				that.popTitle = ''
				that.popContent = ''
				that.popBtn = ''
				that.popTime = ''
				submitZHActiveForm(form).then(res => {
					if (res.state == 1) {
						uni.showToast({
							title: '信息修改成功',
							mask: true,
							icon: 'success',
							duration: 1500
						})
						uni.setStorage({
							key: 'onload',
							data: 'true',
							success() {}
						})
						setTimeout(function() {
							that.isSubmit = true
							uni.reLaunch({
								url: '/pages/group/groupactiveaudit?huodong_id=' + that
									.huodong_id +
									'&channel=' + that
									.channel + '&huodong_join_id=' + that.huodong_join_id
							})
						}, 100)
					} else {
						that.isSubmit = true
						uni.showToast({
							title: res.error[0],
							mask: true,
							icon: 'none',
							duration: 1500
						})
					}
				})
				var params = {
					event_code: '车友会修改表单',
					path: 'pages/group/groupzhactiveform',
					event_id: that.huodong_id,
					title: '',
					source_page: '车友会修改表单-提交信息',
					value: '',
				}
				app.BurialPoint(params)
			}
		}
	}
</script>

<style lang="scss">
	.groupzhactiveform {
		.agremment_box {
			margin-bottom: 180rpx;

			.login_checkbox {
				width: 26rpx;
				height: 26rpx;
				vertical-align: middle;
			}

			.agremment_text {
				color: #191919;
				font-size: 24rpx;
				margin-left: 10rpx;
				vertical-align: middle;
			}
		}

		.popup_img_box {
			position: fixed;
			top: 150rpx;
			left: 60rpx;
			right: 16rpx;
			z-index: 1001;

			.popup_img {
				width: 100%;
				vertical-align: middle;
			}

			.popup_text_box {
				color: #666666;
				font-size: 28rpx;
				position: absolute;
				top: 20%;
				left: 66rpx;
				right: 115rpx;
				z-index: 1002;
				line-height: 42rpx;
			}

			.pop_close_icon_box {
				position: absolute;
				bottom: -80rpx;
				left: 0;
				right: 0;
				z-index: 1002;
				text-align: center;
			}

			.popup_sub {
				margin-top: 20rpx;
				margin-right: 44rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.sub {
					width: 287rpx;
					height: 80rpx;
					line-height: 80rpx;
					color: #FFFFFF;
					font-size: 36rpx;
					background-color: #00A0DC;
					border-radius: 8rpx;
					text-align: center;


					&.left {
						color: #00A0DC;
						background-color: #FFFFFF;
					}
				}
			}
		}


		.fansmeeting_form_bottom_box {
			margin-top: 30rpx;
			padding-top: 30rpx;
			border-top: 1rpx solid #E9E9E9;

			.bottom_ticket_cell {
				padding: 30rpx;
				border-top: 1rpx solid #E9E9E9;
				border-bottom: 1rpx solid #E9E9E9;
			}

			.fansmeeting_form_submit_btn {
				font-size: 30rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				width: 100%;
				color: #ffffff;
				padding: 30rpx 0;
				border-radius: 8rpx;
				background-color: #00A0DC;
			}
		}

		.car_num_type_box {
			font-size: 26rpx;
			margin-top: 45rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			// border-radius: 8rpx;
			// border: 2rpx solid #191919;

			.num_type_cell {
				width: 30%;
				padding: 30rpx 0;
				text-align: center;
				border-radius: 8rpx;
				border: 2rpx solid #191919;
			}

			// .num_type_cell:last-child {
			// 	border-right: 0rpx solid #191919;
			// }

			.num_type_cell_on {
				color: #FFFFFF;
				background-color: #191919;
			}

			// .num_type_cell_on:first-child {
			// 	border-top-left-radius: 8rpx;
			// 	border-bottom-left-radius: 8rpx;
			// }

			// .num_type_cell_on:last-child {
			// 	border-top-right-radius: 8rpx;
			// 	border-bottom-right-radius: 8rpx;
			// }
		}

		.avatar_box {
			width: 80rpx;
			height: 80rpx;

			button::after {
				border: none;
			}

			.avatar_btn {
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: transparent;
				text-align: center;
				font-size: 28rpx;
				font-weight: normal;
				position: relative;
				width: 80rpx !important;
				height: 80rpx;
				padding-left: 0 !important;
				padding-right: 0 !important;
			}

			.avatar {
				width: 80rpx;
				height: 80rpx;
				border-radius: 100rpx;
			}
		}

		.ticket_price_text {
			color: #C92359;
			font-size: 26rpx;
			font-weight: bold;
			text-align: right;
			margin-top: 30rpx;
		}
	}
</style>